package com.example.ricebibackend.common.exception;


import com.example.ricebibackend.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

@Data
@EqualsAndHashCode(callSuper = true)
public class ServiceException extends RuntimeException {
    private Integer code; // 错误码
    private String msg; // 错误信息

    public ServiceException() {}

    public ServiceException(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
    public ServiceException(ErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.msg = errorCode.getMsg();
    }

}
